/**
 * // ============================================================================
 * //
 * // Copyright (C) 2006-2007 Dengues
 * //
 * // Google Group: http://groups.google.com/group/dengues
 * // QQ Group: 24885404
 * //
 * // This library is free software; you can redistribute it and/or
 * // modify it under the terms of the GNU Lesser General Public
 * // License as published by the Free Software Foundation; either
 * // version 2.1 of the License.
 * //
 * // This library is distributed in the hope that it will be useful,
 * // but WITHOUT ANY WARRANTY; without even the implied warranty of
 * // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * // Lesser General Public License for more details.
 * //
 * // You should have received a copy of the GNU General Public License
 * // along with this program; if not, write to the Free Software
 * // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 * //
 * // ============================================================================
 * 
 *
 * $Id$
 */
package org.dengues.model.reports.impl;

import org.dengues.model.reports.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ReportsFactoryImpl extends EFactoryImpl implements ReportsFactory {
    /**
     * Creates the default factory implementation.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public static ReportsFactory init() {
        try {
            ReportsFactory theReportsFactory = (ReportsFactory)EPackage.Registry.INSTANCE.getEFactory("org.dengues.model/reports.ecore"); 
            if (theReportsFactory != null) {
                return theReportsFactory;
            }
        }
        catch (Exception exception) {
            EcorePlugin.INSTANCE.log(exception);
        }
        return new ReportsFactoryImpl();
    }

    /**
     * Creates an instance of the factory.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public ReportsFactoryImpl() {
        super();
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public EObject create(EClass eClass) {
        switch (eClass.getClassifierID()) {
            case ReportsPackage.REPORTS: return createReports();
            case ReportsPackage.PROPERTY: return createProperty();
            case ReportsPackage.STYLE: return createStyle();
            case ReportsPackage.REP_BODY: return createRepBody();
            case ReportsPackage.REP_TABLE: return createRepTable();
            case ReportsPackage.REP_COLUMN: return createRepColumn();
            case ReportsPackage.REP_GROUP: return createRepGroup();
            case ReportsPackage.REP_CELL: return createRepCell();
            case ReportsPackage.REP_ROW: return createRepRow();
            default:
                throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
        }
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public Object createFromString(EDataType eDataType, String initialValue) {
        switch (eDataType.getClassifierID()) {
            case ReportsPackage.PROPERTY_TYPE:
                return createPropertyTypeFromString(eDataType, initialValue);
            case ReportsPackage.GROUP_TYPE:
                return createGroupTypeFromString(eDataType, initialValue);
            default:
                throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
        }
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public String convertToString(EDataType eDataType, Object instanceValue) {
        switch (eDataType.getClassifierID()) {
            case ReportsPackage.PROPERTY_TYPE:
                return convertPropertyTypeToString(eDataType, instanceValue);
            case ReportsPackage.GROUP_TYPE:
                return convertGroupTypeToString(eDataType, instanceValue);
            default:
                throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
        }
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public Reports createReports() {
        ReportsImpl reports = new ReportsImpl();
        return reports;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public Property createProperty() {
        PropertyImpl property = new PropertyImpl();
        return property;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public Style createStyle() {
        StyleImpl style = new StyleImpl();
        return style;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public RepBody createRepBody() {
        RepBodyImpl repBody = new RepBodyImpl();
        return repBody;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public RepTable createRepTable() {
        RepTableImpl repTable = new RepTableImpl();
        return repTable;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public RepColumn createRepColumn() {
        RepColumnImpl repColumn = new RepColumnImpl();
        return repColumn;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public RepGroup createRepGroup() {
        RepGroupImpl repGroup = new RepGroupImpl();
        return repGroup;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public RepCell createRepCell() {
        RepCellImpl repCell = new RepCellImpl();
        return repCell;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public RepRow createRepRow() {
        RepRowImpl repRow = new RepRowImpl();
        return repRow;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public PropertyType createPropertyTypeFromString(EDataType eDataType, String initialValue) {
        PropertyType result = PropertyType.get(initialValue);
        if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
        return result;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String convertPropertyTypeToString(EDataType eDataType, Object instanceValue) {
        return instanceValue == null ? null : instanceValue.toString();
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public GroupType createGroupTypeFromString(EDataType eDataType, String initialValue) {
        GroupType result = GroupType.get(initialValue);
        if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
        return result;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String convertGroupTypeToString(EDataType eDataType, Object instanceValue) {
        return instanceValue == null ? null : instanceValue.toString();
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public ReportsPackage getReportsPackage() {
        return (ReportsPackage)getEPackage();
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @deprecated
     * @generated
     */
    @Deprecated
    public static ReportsPackage getPackage() {
        return ReportsPackage.eINSTANCE;
    }

} //ReportsFactoryImpl
